<template>
  <div class="ty-container">
    <van-nav-bar
      :title="$route.meta.title"
      left-arrow
      :border="false"
      @click-left="clickLeft"
      @click-right="clickRight"
    >
      <template #right>
        <van-icon
          v-show="activeName === '我的申请'"
          name="filter-o"
          size="24"
        />
      </template>
    </van-nav-bar>
    <div class="ty-content">
      <van-tabs v-model="activeName" sticky animated :border="false">
        <van-tab title="生产请验" name="生产请验">
          <apply-form :apply-source="applySource"></apply-form>
        </van-tab>
        <van-tab title="我的申请" name="我的申请">
          <apply-list
            :toggleFilter="toggleFilter"
            :apply-source="applySource"
          ></apply-list>
        </van-tab>
        <!-- <van-tab title="加测申请" name="加测申请">
          <add-record :apply-source="applySource"></add-record>
        </van-tab> -->
      </van-tabs>
    </div>
  </div>
</template>

<script>
import { NavBar, Tab, Tabs, Icon } from "vant";
import ApplyForm from "./components/ApplyForm";
import ApplyList from "./components/ApplyList";
// import AddRecord from "./components/AddRecord";

export default {
  name: "CheckApply",
  components: {
    [NavBar.name]: NavBar,
    [Tab.name]: Tab,
    [Tabs.name]: Tabs,
    [Icon.name]: Icon,
    ApplyForm,
    ApplyList,
    // AddRecord,
  },
  props: {
    applySource: {
      type: String,
      default: "申请检验",
    },
  },
  data() {
    return {
      activeName: "生产请验",
      toggleFilter: false,
    };
  },
  methods: {
    clickLeft() {
      this.$router.replace({ name: "home" });
    },
    clickRight() {
      this.toggleFilter = !this.toggleFilter;
    },
  },
};
</script>

<style lang="less" scoped>
.ty-container {
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background-color: @background-color;
}
.nav-bar {
  background-color: #3eb4f8;
}
/deep/.van-tabs--line .van-tabs__wrap {
  height: 34px;
}
/deep/.van-tab {
  font-size: 13px;
  height: 30px;
}
</style>